package com.bdy.lm.browser.service;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bdy.lm.browser.dao.UserDao;
import com.bdy.lm.common.model.User;

/**
 * 登陆业务实现类
 * @author liming
 * @date   2017年8月16日
 */

@Service("userService")
public class UserService {

	@Autowired
	private UserDao userDao;
	
	public User login(User user) {
		return userDao.queryUser(user);
	}

	@Transactional(readOnly = false)
	public boolean register(User user) {
		userDao.addUser(user);
		return true;
	}
	
	public void saveUsers(final List<User> list){
		for(User c : list) {
			userDao.addUser(c);
		}
	}
	
	public void updateUser(User user) {
		userDao.updateUser(user);
	}
	
	public void deleteUser(User user) {
		userDao.deleteUser(user);
	}
}

